# 如何通过AKI三方库实现ArkTS与C/C++之间的跨语言调用
# the minimum version of CMake.
cmake_minimum_required(VERSION 3.5.0)
project(ndk1)

set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
# [Start aki_cmakelist1]
# 1. 设置AKI根路径
set(AKI_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules/@ohos/aki)
set(CMAKE_MODULE_PATH ${AKI_ROOT_PATH})
find_package(Aki REQUIRED)
# [End aki_cmakelist1]

if(DEFINED PACKAGE_FIND_FILE)
    include(${PACKAGE_FIND_FILE})
endif()

include_directories(${NATIVERENDER_ROOT_PATH}
                    ${NATIVERENDER_ROOT_PATH}/include)

add_library(entry SHARED napi_init.cpp)
# [Start aki_cmakelist2]
target_link_libraries(entry PUBLIC libace_napi.z.so)
# 2. 链接二进制依赖 & 头文件，需要确保target（例如为entry）与add_library()方法中的target保持一致
target_link_libraries(entry PUBLIC Aki::libjsbind)
# [End aki_cmakelist2]